{extend name="admin@public/base_content" /}
{block name="body">}
<body>
{include file="admin@public/common" /}

<div class="layui-form">
    <table class="layui-table lay-even">
        <thead>
        <tr>
            <th style="text-align:center">金额</th>
            <th style="text-align:center">添加时间</th>
            <th style="text-align:center">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="v"}
        <tr>
            <td style="text-align:center">￥{$v.money}</td>
            <td style="text-align:center">{:date('Y-m-d h:i:s',$v['create_time'])}</td>
            <td style="text-align:center">
                <a class="layui-btn layui-btn-mini layui-btn-danger ajax"
                   data-list='{"key":"id={$v.id}","msg":true,"render":"true","action":"del"}'
                   data-params='{"url": "{:url("del")}","confirm":"true","data":"id={$v.id}","complete":"del"}'>
                    <i class="iconfont">&#xe626;</i>删除
                </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
</div>
<div class="text-right">
    <div class="layui-box layui-laypage layui-laypage-molv" id="layui-laypage-1">
        {$page}
    </div>
</div>
<p></p>
<div style="width:40%;background:rgba(0,0,0,0.1);text-align:center;margin-left:30%;border-radius:10px;position:fixed;bottom:0;">
    <p class="show" id="1" style="font-size:20px;margin-bottom:10px;margin-top: 10px">添加收费系数</p>
    <div class="up" style="display: none">
        <div style="overflow: hidden">
            <input class="layui-input" style="width:50%;height:40px;float:left;margin-left:20%;border-radius:40px 0 0 40px" type="number" name="money" placeholder="请输入金额">
            <botton class="layui-btn btn" style="height:40px;float: left;border-radius:0 40px 40px 0">提交</botton>
        </div>
        <div style="color:red;margin-top:20px;margin-bottom: 10px">*此操作为金额操作，请谨慎处理</div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<script src="__ADMIN__/js/jquery/jquery.min.js"></script>
<script>
    layui.use('default',function(){
        $(".show").click(function(){
            if($(this).attr('id') == 1){
                $(this).attr('id',2);
                $(".up").show(function(){});
            }else{
                $(this).attr('id',1);
                $(".up").hide(function(){});
            }
        });
        $(".btn").click(function(){
            $.ajax({
                url:'money',
                type:'post',
                data:{money:$("input[name=money]").val()},
                success:function(res){
                    if(res == 200){
                        layer.msg('完成添加');
                        setTimeout(function(){
                            $(".up").hide(function(){});
                            window.location.reload();
                        },1500)
                    }else{
                        layer.msg(res.msg);
                    }
                }
            })
        });
    });
</script>
{/block}